// import axios from 'axios'
// import request from 'superagent'

const APIs = {
	// 登录API
	// API_LOGIN: '/user/login',
	API_LOGIN: '/ReportWS/login/report/userLogin.do',
	// 登出API
	// API_LOGOUT: '/user/logout',
	API_LOGOUT: '/ReportWS/login/userLoginOut.do',
	// 验证码
	// API_CODE: '/code/login',
	API_CODE: '/ReportWS/veri/report/drawcode.do',
}

module.exports = {

	APIs,

	request,

	API_LOGIN(params) {
		return request(APIs['API_LOGIN'], params)
	},

	API_LOGOUT(params) {
		return request(APIs['API_LOGIN'], params)
	},
}

function request(name, params) {
	return new Promise((resolve, reject) => {
		$.post(APIs[name], params, function(result) {
			resolve(result)
		})
	})
}